﻿<%@ Page Language="C#" AutoEventWireup="true" MasterPageFile="~/Manager/SearchMP.master"  CodeBehind="CarSearch.aspx.cs" Inherits="Agile_E.CarSearch" %>

<asp:Content ID="carsearch" ContentPlaceHolderID="MPsearchmain" runat="server">
    <div>
    <h1>Vehicle Search</h1>
    </div>
    <div>
    <table class="CarSearchtable">
    <tr>
    <td>Make:</td>
    <td style="width:auto"><asp:DropDownList ID="ddlmake" runat="server" DataTextField="Make"
            AppendDataBoundItems="true" DataSourceID="srcddlmake" AutoPostBack="true"
            onselectedindexchanged="ddlmake_SelectedIndexChanged">   
            <asp:ListItem Text="--SELECT--" Value="-1"></asp:ListItem>
        </asp:DropDownList> 
         <asp:SqlDataSource ID="srcddlMake" runat="server" 
        ConnectionString="<%$ ConnectionStrings:TerraNetConnectionString %>" 
        SelectCommand="Select distinct(Make) from Vehicles"
        ProviderName="<%$ ConnectionStrings:TerraNetConnectionString.ProviderName %>" ></asp:SqlDataSource>
    </td></tr>
    <tr><td>Model:</td>
    <td style="width:auto">
    <asp:DropDownList ID="ddlmodel" runat="server" DataSourceID="srcdllmodel" DataTextField="Model"
     DataValueField="Model" AppendDataBoundItems="true"
        onselectedindexchanged="ddlmodel_SelectedIndexChanged"> 
        <asp:ListItem Text="--SELECT--" Value="-1"></asp:ListItem>
    </asp:DropDownList>
        <asp:SqlDataSource ID="srcdllmodel" runat="server" 
        ConnectionString="<%$ ConnectionStrings:TerraNetConnectionString %>"
        ProviderName="<%$ ConnectionStrings:TerraNetConnectionString.ProviderName %>"></asp:SqlDataSource>
    </td></tr>
    <tr>
    <td>
    Price:
    </td>
    <td style="width:auto">
    From&nbsp <asp:TextBox id="txtpricelow" runat="server" Width="100px"></asp:TextBox>&nbsp
    to &nbsp<asp:TextBox ID="txtpricehigh" runat="server" Width="99px" ></asp:TextBox>
    </td>
    </tr>
    <tr>
    <td>Mileage:</td>
    <td style="width:auto">
    From &nbsp<asp:TextBox id="txtmileslow" runat="server" Width="100px"></asp:TextBox>&nbsp
    to &nbsp<asp:TextBox ID="txtmileshigh" runat="server" Width="100px" ></asp:TextBox>
    </td>
    </tr>
    <tr>
    <td>
        <br />
    <asp:Button ID="btncarsearch" runat="server" Text="Search" 
        onclick="btncarsearch_Click" />&nbsp;
        <asp:HyperLink ID="HLaddcar" runat="server" NavigateUrl="~/Manager/AddInventory.aspx" Text="Add New Inventory"></asp:HyperLink>
    </td>
    </tr>
    </table>
    <asp:Label ID="lblcommand" runat="server"></asp:Label>
    <br />
    
    <asp:GridView ID="grdCar" runat="server" DataSourceID="srcVehicles" AutoGenerateColumns="False" 
     RowStyle-HorizontalAlign="Center" BackColor="White" 
        BorderColor="#999999" BorderStyle="None" BorderWidth="1px" CellPadding="3" onr
        GridLines="Vertical" CssClass="CarGridStyle" OnDataBound="grdCar_OnDataBound" >
     <RowStyle CssClass="CarGridRowStyle" BackColor="#EEEEEE" ForeColor="Black"  />
        <FooterStyle BackColor="#CCCCCC" ForeColor="Black" />
        <PagerStyle BackColor="#999999" ForeColor="Black" HorizontalAlign="Center" />
        <SelectedRowStyle BackColor="#008A8C" Font-Bold="True" ForeColor="White" />
     <HeaderStyle CssClass="CarGridHeaderRowStyle" BackColor="#000084" Font-Bold="True" 
            ForeColor="White" />
    <Columns>
        <asp:BoundField HeaderText="Make" DataField="Make" />
        <asp:BoundField HeaderText="Model" DataField="Model" />
        <asp:BoundField HeaderText="Year" DataField="V_Year" />
        <asp:BoundField HeaderText="VIN" DataField="VIN" />
        <asp:BoundField HeaderText="Mileage" DataField="Mileage" />
        <asp:BoundField HeaderText="Condition" DataField="V_Condition" />
        <asp:BoundField HeaderText="Price" DataField="MSRP" />
        <asp:BoundField HeaderText="Status" DataField="Vehicle_Status" />
        <asp:HyperLinkField DataNavigateUrlFields="Vin" DataNavigateUrlFormatString="UpdateVehicles.aspx?vin={0}"
                 Text="Select" NavigateUrl="~/Manager/UpdateVehicles.aspx" />
    </Columns>
        <AlternatingRowStyle BackColor="#DCDCDC" />
    </asp:GridView>
    <asp:SqlDataSource ID="srcVehicles" runat="server" 
        ConnectionString="<%$ ConnectionStrings:TerraNetConnectionString %>" 
        ProviderName="<%$ ConnectionStrings:TerraNetConnectionString.ProviderName %>" ></asp:SqlDataSource>
    <br />
</div>
    
</asp:Content>